#pragma once
#include "../stdafx.h"
#include "../math/math.h"
#include "Tmp_Manager.h"
class AABB;

typedef struct _VERTEXBUFFER
{
    LPDIRECT3DVERTEXBUFFER9 pVB;
    int32 count;
}VERTEXBUFFER;

struct FIGURE
{
    int32 mid;
    string name;
    WorldPoint pos;
    FACE face;
    VERTEXBUFFER VB[16];
    AABB* aabb;
    int32 nVB;
    FIGURE_ABILITY fa;
    inline int32 GetID(){ return id;}
    inline void SetID(int32 _id) {id=_id;} 
private:
    int32 id;
   
};


class FigureManager:
    public Manager<FIGURE>, public Component
{
public:
    FigureManager(void);
    ~FigureManager(void);

    void addedToObject();
    bool AddVB(int32,LPDIRECT3DVERTEXBUFFER9,int32);
    D3DXVECTOR3 GetMidPos(int32 id);
    int32 GetFidFromCell(WorldPoint);
    bool ClearVB();
    int32 HasObj(int32);
    void Log();
    int32 GetMid(int32);

    void AddFigure(Message const &msg);
};
